package com.MRSyc.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.MRSyc.config.PageModel;
import com.MRSyc.entity.TResources;
import com.MRSyc.mapper.TResourcesMapper;
import com.MRSyc.service.ITResourcesService;
import com.MRSyc.utils.ToolKit;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Fxq
 * @since 2021-01-12
 */
@Service
public class TResourcesServiceImpl extends ServiceImpl<TResourcesMapper, TResources> implements ITResourcesService {

	@Autowired
	TResourcesMapper mapper;
	
	@Override
	public List<TResources> findAll() {
		// TODO Auto-generated method stub
		return mapper.findAll();
	}

	@Override
	public TResources findOne(TResources record) {
		// TODO Auto-generated method stub
		return mapper.findOne(record);
	}

	@Override
	public List<TResources> findList(TResources record) {
		// TODO Auto-generated method stub
		return mapper.findList(record);
	}

	@Override
	public List<TResources> findPageList(PageModel<TResources> page, TResources resources) throws Exception {
		// TODO Auto-generated method stub
		HashMap<String, Object> hashMap = ToolKit.javaBeanToMap(resources);
        List<TResources> pageList = findListByMapLimit(hashMap, page.getMsFirst(), page.getMsLast());
        return pageList;
	}

	@Override
	public List<TResources> findListByMapLimit(HashMap<String, Object> hashMap, long first, long last) {
		// TODO Auto-generated method stub
		hashMap.put("msFirst",first);
        hashMap.put("msLast",last);
        return mapper.findListByMapLimit(hashMap);
	}

	@Override
	public long findCount(TResources resources) throws Exception {
		// TODO Auto-generated method stub
		return mapper.findCount(resources);
	}

	@Override
	public long findCountByMap(HashMap<String, Object> hashMap) {
		// TODO Auto-generated method stub
		return mapper.findCountByMap(hashMap);
	}


	@Override
	public TResources findById(int resourcesId) {
		// TODO Auto-generated method stub
		return mapper.findById(resourcesId);
	}

	

}
